#!/sbin/openrc-run
supervisor=supervise-daemon

name=navidrome
description="Modern Music Server and Streamer compatible with Subsonic/Airsonic"

command=/usr/bin/navidrome
command_args="--nobanner --configfile $navidrome_configfile"
command_user="navidrome:navidrome"
directory="/var/lib/$RC_SVCNAME"

extra_started_commands="scan"

start_pre() {
	[ -n "$error_log" ] && checkpath -f "$error_log" \
		-m 644 -o navidrome:navidrome
}

scan() {
	${supervisor} "${SVCNAME}" --signal USR1
}

depend() {
	need net localmount
	after firewall
}
